'use strice';
// import Vue from 'vue'
import router from './router';
import store from './store/';
import components from './components/'; //加载公共组件
import ajax from './api/api';
import comJS from './js/common';//加载通用js
import Interactive from './js/interactive';  //交互
import './css/common.css';
import './less/app.less';
import './rem/rem';
import loadImg from './assets/img/loadImg.png';
require('es6-promise').polyfill();
//  改变微信头部
Vue.use(require('vue-wechat-title'));
import { LoadingPlugin, ConfirmPlugin, ToastPlugin, AlertPlugin, WechatPlugin, DatetimePlugin } from 'vux';
// import VueScroller from 'vue-scroller'
// import VueLazyLoad from 'vue-lazyload'
// import VueClipboard from 'vue-clipboard2'  //  复制
Vue.use(VueClipboard);
//  vux 插件
Vue.use(LoadingPlugin);
Vue.use(ConfirmPlugin);
Vue.use(ToastPlugin);
Vue.use(AlertPlugin);
Vue.use(WechatPlugin);
Vue.use(DatetimePlugin);

Vue.use(components);
Vue.use(ajax);
Vue.use(router);
Vue.use(comJS);
Vue.use(VueScroller);
Vue.use(Interactive);
Vue.use(VueAwesomeSwiper);
Vue.use(VueLazyload,{
    error:loadImg,
    loading:loadImg
});



window._crypto = null;


//  myLoad 为false  则有loading效果  每次请求完初始化为false
global.myLoad = false;


//
if(process.env.NODE_ENV == 'production'){ //生产环境\
    window.alert = function(){
    };
    /*window.console.log = function(){
    }*/
}
if(window.location.href.indexOf('from=App')>=0){
    pageStart();
}else{
    new Vue({
        store,
        router,
    }).$mount('#app');
}
let t = null;
function pageStart() {
    console.log('??????????????????????????????????????????????????????','开始检测',  new Date());
    if(window.localStorage.hasOwnProperty('t')){
        clearTimeout(t);
        console.log('??????????????????????????????????????????????????????','检测到移动端写入本地存储',  new Date());
        t = null;
        new Vue({
            store,
            router,
        }).$mount('#app');
    }else{
        t = setTimeout(()=>{
            pageStart();
        },50);
    }

}